[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+-------+##################################################################
#+-| ASC() |------------------------------------+#############################
#| +-------+ Returns the numeric ASCII value of |#############################
#| the first character of a string |#############################
#+----------------------------------------------+#############################
##############################################################################
##############################################################################
#+--| Summary |----------------+##############################################
#| #INCLUDE string.hdr |##############################################
#+-----------------------------+##############################################
##############################################################################
##############################################################################
#+--| Syntax |---------------------------+####################################
#| FUNCTION UINT asc PROTOTYPE |####################################
#| PARAMETERS CONST CHAR string |####################################
#+---------------------------------------+####################################
##############################################################################
##############################################################################
################+---| Description |-------------------------+#################
################| The asc() function returns the ASCII code |#################
################| value of the first character of string. |#################
################+-------------------------------------------+#################
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * Divide a classroom into classes A-M and N-Z. |#########
#########| |#########
#########| IF asc( student_name ) > 'N' |#########
#########| REPLACE class->cls_num WITH 1 |#########
#########| ELSE |#########
#########| REPLACE class->cls_num WITH 0 |#########
#########| ENDIF |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * Single quoted, single character strings are |#########
#########| * considered to be the "asc" value of the |#########
#########| * enclosed character. |#########
#########| |#########
#########| ? 'N', asc("N") && These are identical |#########
#########| && statements. Both print |#########
#########| && the same value. |#########
#########| ? 'a' > 'A' && This is faster because |#########
#########| && the FORCE compiler |#########
#########| && uses the ascii value at |#########
#########| && COMPILE time, versus |#########
#########| && calling asc() at |#########
#########| && runtime. |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
####+-----------------------------| NOTE: |-------------------------------+###
####| The FORCE language regards single-quoted, length-one |###
####| characters as a byte (numeric) value. For a single character to be |###
####| regarded as a string, place it in double quotes. |###
####+---------------------------------------------------------------------+###
##############################################################################
See Also:
chr()
val()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson